feat: add content_format option to get_emails_content#106
Open
jkp wants to merge 3 commits intoai-zerolab:mainfrom
Open
feat: add content_format option to get_emails_content#106jkp wants to merge 3 commits intoai-zerolab:mainfrom
jkp wants to merge 3 commits intoai-zerolab:mainfrom
Conversation
Add a content_format parameter to extract clean text from HTML emails: - "raw" (default): text/plain preferred, falls back to HTML - "html": return HTML content as-is - "text": strip HTML tags to return clean plain text - "markdown": convert HTML to markdown format Uses justhtml library for HTML parsing and conversion. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- Add default_content_format to Settings class (defaults to "raw") - Support MCP_EMAIL_SERVER_DEFAULT_CONTENT_FORMAT env var - Validate content format values (raw, html, text, markdown) - Update get_emails_content to use setting when format not specified - Add tests for new configuration option - Update README with configuration documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Member
|
Looks good. Can you resolve the conflict? |
Member
|
Looks good. Can you resolve the conflict? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
content_formatparameter toget_emails_contentto control how email body content is formattedraw(default),html,text, andmarkdownjusthtmllibrary for HTML-to-text and HTML-to-markdown conversionMotivation
When processing emails programmatically, raw HTML content can be difficult to work with. This feature allows extracting clean text from HTML emails, making content easier to process.
API Changes
Test plan
_format_body_contenthelper function (9 tests)_parse_email_dataextracting HTML content (3 tests)🤖 Generated with Claude Code